<template>
  <div>
    <div class="mui-numbox" data-numbox-step='1'  data-numbox-min="1" data-numbox-max="100">
      <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
      <input class="mui-numbox-input" type="number" ref="number" @change="getNumber"/>
      <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
  </div>
</template>
<script>

import mui from '../../lib/mui/js/mui.min.js'
export default {
    data() {
        return {
            count:null
        }
    },
    methods: {
        // 子组件调用这个函数  把值传给父组件
        getNumber(){
            this.count = this.$refs.number.value;
            //调用父组件方法，把值传递过去
            this.$emit("get",parseInt(this.count))
        }
    },
    mounted() {
        mui('.mui-numbox').numbox();
    },
};
</script>
<style lang="less" scoped>
</style>
